'''
对抗反爬虫的大杀器: 正向代理

常用的免费代理网站:
    http://www.xicidaili.com/
    http://www.kuaidaili.com/free/inha/
    http://www.proxy360.cn/default.aspx
    http://www.goubanjia.com/free/index.shtml


'''
import urllib.request as ur

httpproxy_handler = ur.ProxyHandler({'http':'39.108.226.252:8118'})

opener = ur.build_opener(httpproxy_handler)     # 使用代理必须自建 Handler和opener

request = ur.Request('http://www.baidu.com')

response = opener.open(request)

print(response.read().decode('utf8'))